<!DOCTYPE html>
<html>
<head>
<title>Black Admin v2 - Template Admin - Nice Theme</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="all">
@import url(css/style.css);
img {
	behavior: url('js/iepngfix.htc') !important;
}
</style>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery_ui.js" type="text/javascript"></script>
<script src="js/wysiwyg.js" type="text/javascript"></script>
<script src="js/functions.js" type="text/javascript"></script>
</head>
<body>
<div id="container"> <!-- Container -->
  <div id="header"> <!-- Header -->
    <div id="title">
			 Admin
			<span>Quản lý webside</span>
		</div>
  </div>
  <div id="sidebar"> <!-- Sidebar -->
		<div class="sidebox">
			<span class="stitle">Navigation</span>
		  <div id="navigation"> <!-- Navigation begins here -->
        <div class="sidenav"><!-- Sidenav -->
          <div class="navhead_blank"><span><a href="#" title="">Trở về trang chủ</a></span></div>
          <div class="navhead"><span>Album</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Taoalbum.php" title="">Tạo Album</a></li>
              <li><a href="album.php" title="">Quản lý Album</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Bài hát</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="thembaihat.php" title="">Thêm bài hát</a></li>
              <li><a href="quanlybaihat.php" title="">Quản lý bài hát</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Bình Luận</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="quanlycoment.php" title="">Quản lý Bình Luận</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Nghệ sĩ</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Themnghesi.php" title="">Thêm Nghệ sĩ</a></li>
              <li><a href="quanlynghesi.php" title="">Quản lý nghệ sĩ</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Playlist</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Taoplaylist.php" title="">Tạo Danh Sách Nhạc</a></li>
              <li><a href="Quanlydanhsachnhac.php" title="">Quản lý danh sách nhạc</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Thể Loại</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Themtheloai.php" title="">Thêm thể loại</a></li>
              <li><a href="quanlytheloainhac.php" title="">Quản lý thể loại</a></li>
            </ul>
          </div>
          <div class="navhead"><span>User</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="quanlyuser.php" title="">Quản lý user</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Album_music</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Album_music.php" title="">Quản lý Album_music</a></li>
               <li><a href="ThemAlbum_music.php" title="">Thêm Album_music</a></li>
            </ul>
          </div>
          
          <div class="navhead"><span>Bài Hát_nghệ sĩ</span></div>
          <div class="subnav">
            <ul class="submenu">
              <li><a href="Music_nghesi.php" title="">Quản lý Bài Hát_nghệ sĩ</a></li>
              <li><a href="themMusic_nghesi.php" title="">Thêm Bài Hát_nghệ sĩ</a></li>
            </ul>
          </div>
          <div class="navhead"><span>Music_Playlist</span></div>
					<div class="subnav">
						<ul class="submenu">
							<li><a href="Baihat_Playlist.php" title="">Quản lý Music_playlist</a></li>
                            <li><a href="themMusic_playlist.php" title="">Thêm Music_playlist</a></li>
							
						</ul>
					</div>
        </div>
      </div> <!-- END Navigation -->
		</div>
		<div class="sidebox">
			<span class="stitle">Additional Panel</span>
			<div id="datepicker"></div>

		</div>
		
		
	</div> <!-- END Sidebar -->
  <div id="main"> <!-- Main, right side content -->
    <div id="content"> <!-- Content begins here -->
      
      <h2>Tables</h2>
      <table cellspacing="0" cellpadding="0" border="0">
        <!-- Table -->
        <thead>
          <tr>
            <th><input type="checkbox" class="checkall" /></th>
            <?php
                            $conn = mysql_connect("localhost", "root","123456") or die("Ket noi den MySQL that bai");
                            mysql_select_db("mp3", $conn);
                            mysql_query("SET NAMES UTF8",$conn);
                            $qColumnNames = mysql_query("SHOW COLUMNS FROM `music`;");
                            $numColumns = mysql_num_rows($qColumnNames);
                            $x = 0;
                            while ($x < $numColumns)
                            {
                                $colname = mysql_fetch_row($qColumnNames);
                                $col[$colname[0]] = $x;
                                $x++;
                            ?>
            <th><?=$colname[0]?></th>
            <?php
                              }
                                    mysql_close($conn);
                            ?>
            <th>action</th>
          </tr>
        </thead>
        <tbody>
          <?php
                                $conn = mysql_connect("localhost", "root","123456") or die("Ket noi den MySQL that bai");
                                mysql_select_db("mp3", $conn) or die("Ket noi den MySQL that bai");
                                mysql_query("SET NAMES UTF8",$conn);
								if (!isset($_GET['page'])) 
									 {
										$_GET['page'] = 1;
									 }
									$vitri = ($_GET["page"] - 1 ) * 5 ;  
								$sql = "SELECT * FROM music limit ".$vitri.",5";
                                $qq = mysql_query($sql);  
								$numrow=0;
							     if( mysql_num_rows($qq)>0){$numrow= mysql_num_rows($qq);}                
								//phải ít nhất 2 dòng dữ liệu
                                while ($numrow>0)
                                {
									echo '<tr>
            							<td><input type="checkbox" /></td>';
									$row = mysql_fetch_array($qq, MYSQL_NUM);
									echo "<td>  $row[0]</td>";
									echo "<td>  $row[1]</td>";
									echo "<td>  $row[2]</td>";
									echo "<td>  $row[3]</td>";
									echo "<td>  $row[4]</td>";
									echo "<td><textarea> $row[5]</textarea></td>";
									echo "<td>  $row[6]</td>";
									echo "<td>  $row[7]</td>";
									echo "<td>  $row[8]</td>";
									echo "<td>  $row[9]</td>";
									
									?>
        <td><a href="suabaihat.php?id_music=<?=$row[0]?>"><img src="assets/action_add.png" alt="Add" /><a href="#"><img src="assets/action_delete.png" alt="Delete" /></a></td>
          <?php
									echo '</tr>';
									$numrow--;
									
							  	}
								echo "</tr>";
          echo "</tbody>";
        
      echo"</table>";
								$re = mysql_query("SELECT * FROM music");
    $n = mysql_num_rows($re);
    $tong_so_trang = floor($n/5);
    echo"<ul class='paginator'>";
    if ($_GET['page'] > 1) 
    { 
        echo"<li>";
        echo '<a href=quanlybaihat.php?page='.($_GET['page']-1).'>&emsp;<&emsp;</a>';
        echo"</li>";
    }
    $begin=$_GET['page']-2;
    if ($begin < 1)
    {
        $begin=1;
    }
    $end=$_GET['page']+2;
    if ($end > $tong_so_trang)
    {
        $end = $tong_so_trang;
    }
   
     for ($i=$begin ; $i<=$end ; $i++) 
      {
        
       if ($i == $_GET["page"]) 
       {
        echo"<li class='current'>";
       echo "<a>".$i."</a>";
       echo"</li>";
       }
        
       else
     {
             echo"<li>";
            echo '<a style=border:1px solid white ; href=quanlybaihat.php?page='.$i.'>&emsp;'.$i.'&emsp;</a>';
              echo"</li>";
     }
     }
        
      
      if ($_GET['page'] < $tong_so_trang) 
    { 
         echo"<li>";
        echo '<a href=quanlybaihat.php?page='.($_GET['page']+1).'>&emsp;>&emsp;</a>';
        echo"</li>";
    }  
   
     echo"</ul>";
								                            
            								
                                mysql_close($conn);
                            ?>
        
      <!-- END Table -->
      
      <div class="clear"><!-- --></div>
    </div>
    <!-- END Content --> 
    
  </div>
  <div id="footer">
    <p>Copyright <a rel="dofollow" target="_blank" href="http://nicetheme.net/">Nice Theme</a> 2009. All rights reserved.</p>
  </div>
</div>
<!-- END Container -->
</body>
</html>